<?php

class TestimonialRecord extends TActiveRecord
{
	const TABLE='tbl_testimonial';

	public $ID;
	public $TestimonialFrom;
	public $Testimonial;
	public $Status;
	public $CreateBy;
	public $CreateDate;
	public $ModifyBy;
	public $ModifyDate;
	
	public static $COLUMN_MAPPING=array
	(
		'testimonial_id'=>'ID',
		'testimonial_from'=>'TestimonialFrom',
		'testimonial'=>'Testimonial',
		'status'=>'Status',
		'c_by'=>'CreateBy',
		'c_date'=>'CreateDate',
		'm_by'=>'ModifyBy',
		'm_date'=>'ModifyDate'
	);

	public static function finder($className=__CLASS__)
	{
		return parent::finder($className);
	}
	
	public function save()
	{
		if ($this->ID <= 0)
		{
			$this->CreateDate = time();
			$this->CreateBy = Prado::getApplication()->User->ID;
		}
		$this->ModifyDate = time();
		$this->ModifyBy = Prado::getApplication()->User->ID;
		parent::save();
	}
	
	public function getAllItems()
	{
		$criteria = new TActiveRecordCriteria;
		$criteria->Condition = "testimonial_id > 0";
		return self::finder()->findAll($criteria);
	}
}
?>